package jsj.open.lib.ext

import android.content.res.Resources

val Number.dp : Int
    get() = android.util.TypedValue.applyDimension(
        android.util.TypedValue.COMPLEX_UNIT_DIP, this.toFloat(), Resources.getSystem().displayMetrics).toInt()

val String.isVideo : Boolean
    get() = contains(".mp4",ignoreCase = true)
            || contains(".avi",ignoreCase = true)
            || contains(".mkv",ignoreCase = true)
            || contains(".mov",ignoreCase = true)
            || contains(".wmv",ignoreCase = true)
val String.isAudio : Boolean
    get() = contains(".mp3",ignoreCase = true)
            || contains(".wav",ignoreCase = true)
            || contains(".aac",ignoreCase = true)
            || contains(".ogg",ignoreCase = true)
            || contains(".wma",ignoreCase = true)
val String.isPicture : Boolean
    get() = contains(".jpg",ignoreCase = true)
            || contains(".png",ignoreCase = true)
            || contains(".jpeg",ignoreCase = true)